﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MuaChungDAO;
using MuaChungDAO;
using MuaChungDTO;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
namespace MuaChungDAO
{
    public class DealHandler
    {
        //public static DealDataSet napTatCa()
        //{
        //    return napTongQuat("select * from Deal");
        //}

        //public static DealDataSet napTheoLoai(string loaiID)
        //{
        //    return napTongQuat("select * from Deal where LoaiDealID = " + loaiID.ToString());
        //}

        //public static DealDataSet napTheoID(string dealID)
        //{
        //    return napTongQuat("select * from Deal where DealID = " + dealID.ToString()); 
        //}

        //private static DealDataSet napTongQuat(string querySQL)
        //{
        //    SqlConnection conn = NguoiKetNoi.ketNoi("NhomMuaConnectionString");

        //    SqlCommand cm = new SqlCommand();
        //    cm.CommandText = querySQL;
        //    cm.Connection = conn;

        //    SqlDataAdapter da = new SqlDataAdapter();
        //    da.SelectCommand = cm;

        //    DealDataSet ds = new DealDataSet();
        //    da.Fill(ds.Deal);
        //    return ds;
        //}
        ////////////////////////////////////////////////////////

        private DealDTO info = new DealDTO();
        private DealDAO data = new DealDAO();

        public static DataTable napTatCa()
        {
            return NhomMuaHandler.napTongQuat("select * from Deal");
        }

        public static DataTable napTheoLoai(string loaiID)
        {
            return NhomMuaHandler.napTongQuat("select * from Deal where LoaiDealID = " + loaiID.ToString());
        }

        public static DataTable napTheoID(string dealID)
        {
            return NhomMuaHandler.napTongQuat("select * from Deal where DealID = " + dealID.ToString());
        }

        public ArrayList getDSDeal()
        {
            return data.getDsDeal();
        }

        public ArrayList getDsDealTheoLoai(string loaiID)
        {
            return data.getDealTheoLoaiID(loaiID);
                
        }

        public ArrayList getDSDealTheoId(string id)
        {
            return data.getDealTheoID(id);
        }
    }
}
